﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Media;
using System.Windows.Media.Imaging;

namespace DailyStrips.Model.ImageProvideStrategies
{
  public class NullImageProviderStrategy : IImageProviderStrategy
  {
    #region IImageProviderStrategy Members

    public ImageSource GetImage(DateTime date)
    {
      int width = 128;
      int height = width;
      int stride = width / 8;
      byte[] pixels = new byte[height * stride];

      // Try creating a new image with a custom palette.
      List<System.Windows.Media.Color> colors = new List<System.Windows.Media.Color>();
      colors.Add(System.Windows.Media.Colors.Red);
      colors.Add(System.Windows.Media.Colors.Blue);
      colors.Add(System.Windows.Media.Colors.Green);
      BitmapPalette myPalette = new BitmapPalette(colors);

      // Creates a new empty image with the pre-defined palette

      BitmapSource image = BitmapSource.Create(
          width,
          height,
          96,
          96,
          PixelFormats.Indexed1,
          myPalette,
          pixels,
          stride);

      return image;
    }

    public bool IsImageAvailable(DateTime date)
    {
      return true;
    }

    #endregion
  }
}
